<div id="toolbar-box">
  <div class="t">
    <div class="t">
      <div class="t"></div>
    </div>
  </div>

  <div class="m">
    <div id="toolbar" class="toolbar">
      <table class="toolbar">
        <tbody>
          <tr>
            <td id="toolbar-unpublish" class="button"><a class="toolbar" onClick="javascript:if(document.adminForm.boxchecked.value==0){alert('Please select a User from the list to Unpublish');}else{if(confirm('Are you sure you want to Unpublish the listed Items?')){submitbutton('unpublished');}}" href="javascript:void(0);"> <span title="Unpublish" class="icon-32-unpublish"> </span> Unpublish </a></td>
            <td id="toolbar-publish" class="button"><a class="toolbar" onClick="javascript:if(document.adminForm.boxchecked.value==0){alert('Please select a User from the list to Publish');}else{if(confirm('Are you sure you want to Publish the listed Items?')){submitbutton('published');}}" href="javascript:void(0);"> <span title="Publish" class="icon-32-publish"> </span> Publish </a></td>
            <td id="toolbar-delete" class="button"><a class="toolbar" onClick="javascript:if(document.adminForm.boxchecked.value==0){alert('Please select a User from the list to delete');}else{if(confirm('Are you sure you want to delete the listed Items?')){submitbutton('remove');}}" href="javascript:void(0);"> <span title="Delete" class="icon-32-delete"> </span> Delete </a></td>
            <td id="toolbar-new" class="button"><a class="toolbar" onClick="submitbutton('add')" href="javascript:void(0);"> <span title="New" class="icon-32-new"> </span> New </a></td>
          </tr>
        </tbody>
      </table>
    </div>
    <div class="header icon-48-user">Danh sách game</div>
    <div class="clr"></div>
  </div>
  <div class="m">
    <div id="toolbar" class="toolbar">
        <table class="toolbar">
            <tbody><tr>
                <td id="toolbar-publish" class="button"><a class="toolbar" onClick="javascript:if(document.adminForm.boxchecked.value==0){alert('Please select a User from the list to Unpublish');}else{if(confirm('Are you sure you want to hotgame the listed Items?')){submitbutton('popular');}}" href="javascript:void(0);"> <span title="set hotgame" class="icon-32-publish"> </span>set popular</a></td>
                <td id="toolbar-unpublish" class="button"><a class="toolbar" onClick="javascript:if(document.adminForm.boxchecked.value==0){alert('Please select a User from the list to Unpublish');}else{if(confirm('Are you sure you want to unhotgame the listed Items?')){submitbutton('unpopular');}}" href="javascript:void(0);"> <span title="Unset hotgame" class="icon-32-unpublish"> </span>Unset popular</a></td>


                <td id="toolbar-publish" class="button"><a class="toolbar" onClick="javascript:if(document.adminForm.boxchecked.value==0){alert('Please select a User from the list to Unpublish');}else{if(confirm('Are you sure you want to hotgame the listed Items?')){submitbutton('populargameincat');}}" href="javascript:void(0);"> <span title="set hotgame" class="icon-32-publish"> </span>set populargameincat</a></td>
                <td id="toolbar-unpublish" class="button"><a class="toolbar" onClick="javascript:if(document.adminForm.boxchecked.value==0){alert('Please select a User from the list to Unpublish');}else{if(confirm('Are you sure you want to unhotgame the listed Items?')){submitbutton('unpopulargameincat');}}" href="javascript:void(0);"> <span title="Unset hotgame" class="icon-32-unpublish"> </span>Unset populargameincat</a></td>
                <td id="toolbar-publish" class="button"><a class="toolbar" onClick="javascript:if(document.adminForm.boxchecked.value==0){alert('Please select a User from the list to Unpublish');}else{if(confirm('Are you sure you want to hotgame the listed Items?')){submitbutton('hotgameincat');}}" href="javascript:void(0);"> <span title="set hotgame" class="icon-32-publish"> </span>set hotgame incat</a></td>
                <td id="toolbar-unpublish" class="button"><a class="toolbar" onClick="javascript:if(document.adminForm.boxchecked.value==0){alert('Please select a User from the list to Unpublish');}else{if(confirm('Are you sure you want to unhotgame the listed Items?')){submitbutton('unhotgameincat');}}" href="javascript:void(0);"> <span title="Unset hotgame" class="icon-32-unpublish"> </span>Unset hotgame incat</a></td>
                <td id="toolbar-publish" class="button"><a class="toolbar" onClick="javascript:if(document.adminForm.boxchecked.value==0){alert('Please select a User from the list to Unpublish');}else{if(confirm('Are you sure you want to hotgame the listed Items?')){submitbutton('hotgame');}}" href="javascript:void(0);"> <span title="set hotgame" class="icon-32-publish"> </span>set hotgame</a></td>
                <td id="toolbar-unpublish" class="button"><a class="toolbar" onClick="javascript:if(document.adminForm.boxchecked.value==0){alert('Please select a User from the list to Unpublish');}else{if(confirm('Are you sure you want to unhotgame the listed Items?')){submitbutton('unhotgame');}}" href="javascript:void(0);"> <span title="Unset hotgame" class="icon-32-unpublish"> </span>Unset hotgame</a></td>
                <td id="toolbar-publish" class="button"><a class="toolbar" onClick="javascript:if(document.adminForm.boxchecked.value==0){alert('Please select a User from the list to Unpublish');}else{if(confirm('Are you sure you want to hotgamedaily the listed Items?')){submitbutton('hotgamedaily');}}" href="javascript:void(0);"> <span title="set hotgame" class="icon-32-publish"> </span>set hotgame daily</a></td>
                <td id="toolbar-unpublish" class="button"><a class="toolbar" onClick="javascript:if(document.adminForm.boxchecked.value==0){alert('Please select a User from the list to Unpublish');}else{if(confirm('Are you sure you want to unhotgamedaily the listed Items?')){submitbutton('unhotgamedaily');}}" href="javascript:void(0);"> <span title="Unset hotgame" class="icon-32-unpublish"> </span>Unset hotgame daily</a></td>
            </tr></tbody>
        </table>
    </div>
    <div class="clr"></div>
  </div>
  <div class="b">
    <div class="b">
      <div class="b"></div>
    </div>
  </div>
</div>
<?php echo $this->Session->flash('msg'); ?>
<div id="submenu-box">
  <div class="t">
    <div class="t">
      <div class="t"></div>
    </div>
  </div>
  <div class="m">
    <ul id="submenu">
      <li> <a href="<?php echo $this->Html->url(array('controller'=>'game_categories', 'action' => 'index')); ?>">Danh mục</a> </li>
      <li> <a href="<?php echo $this->Html->url(array('controller'=>'game_groups', 'action' => 'index')); ?>">Nhóm</a> </li>
      <li> <a class="active" href="<?php echo $this->Html->url(array('controller'=>'games', 'action' => 'index')); ?>">Games</a> </li>
    </ul>
    <div class="clr"></div>
  </div>
  <div class="b">
    <div class="b">
      <div class="b"></div>
    </div>
  </div>
</div>
<div id="element-box">
  <div class="t">
    <div class="t">
      <div class="t"></div>
    </div>
  </div>
  <div class="m">
    <form action="<?php echo $this->Html->url(array('controller'=>'games')); ?>" method="post" name="adminForm">
      <table>
        <tr>
          <td> Keyword: <input type="text" name="search" id="search" class="text_area" value="<?php echo $this->SEARCH_KEYWORD;?>"/>
                 Category: <?php echo $this->Form->select('cat_id', $game_cat_all, array('empty'=> true,'secure'=>true, 'value' => $cat_id)); ?>
                 Nhóm: <?php echo $this->Form->select('group_id', $game_group_all, array('empty'=> true,'secure'=>true, 'value' => $group_id)); ?>
                <button onClick="document.adminForm.limitstart.value=0; document.adminForm.submit();">Go</button>
                <button onClick="document.adminForm.limitstart.value=0; document.adminForm.search.value=''; document.adminForm.submit();">Clear</button>
            </td>
        </tr>
      </table>
      <table class="adminlist">
        <thead>
          <tr>
            <th width="5%"> Num </th>
            <th width="5%"> <input type="checkbox" name="toggle" value=""  onclick="checkAll(<?php echo $total;?>);" />
            </th>
            <th class="title"> <?php echo $this->Paginator->sort('title', 'Title'); ?> </th>
            <th class="title"> <?php echo $this->Paginator->sort('cat_id', 'Category'); ?> </th>
            <th class="title"> <?php echo $this->Paginator->sort('group_id', 'Nhóm'); ?> </th>
            <th class="title"> <?php echo $this->Paginator->sort('published', 'Published'); ?> </th>
            <th class="title"> <?php echo $this->Paginator->sort('popular', 'Popular'); ?> </th>
            <th class="title"> <?php echo $this->Paginator->sort('hot_game', 'Hot game'); ?> </th>
            <th class="title"> <?php echo $this->Paginator->sort('hot_game_ordering', 'Hotgame Order'); ?>
                <a title="Save Order" href="javascript:saveorder(<?php echo $total_inpage - 1;?>, 'savehotgameorder')"><?php echo $this->Html->image('filesave.png');?></a>
             </th>
            <th class="title"> <?php echo $this->Paginator->sort('popular_incat', 'populargame incat'); ?> </th>
            <th class="title"> <?php echo $this->Paginator->sort('popular_incat_ordering', 'populargame incat Order'); ?>
                <a title="Save Order" href="javascript:saveorder(<?php echo $total_inpage - 1;?>, 'savepopulargameincatorder')"><?php echo $this->Html->image('filesave.png');?></a>
             </th>

            <th class="title"> <?php echo $this->Paginator->sort('hot_game_incat', 'Hotgame incat'); ?> </th>
            <th class="title"> <?php echo $this->Paginator->sort('hot_game_incat_ordering', 'Hotgame incat Order'); ?>
                <a title="Save Order" href="javascript:saveorder(<?php echo $total_inpage - 1;?>, 'savehotgameincatorder')"><?php echo $this->Html->image('filesave.png');?></a>
             </th>

            <th class="title"> <?php echo $this->Paginator->sort('hot_game_daily', 'Hot game daily'); ?> </th>
            <th class="title"> <?php echo $this->Paginator->sort('hot_game_daily_ordering', 'Hotgame daily Order'); ?>
                <a title="Save Order" href="javascript:saveorder(<?php echo $total_inpage - 1;?>, 'savehotgamedailyorder')"><?php echo $this->Html->image('filesave.png');?></a>
             </th>
            <th class="title"> <?php echo $this->Paginator->sort('ordering', 'Order'); ?>
                <a title="Save Order" href="javascript:saveorder(<?php echo $total_inpage - 1;?>, 'saveorder')"><?php echo $this->Html->image('filesave.png');?></a>
             </th>
            <th class="title"> <?php echo $this->Paginator->sort('incat_ordering', 'Category Order'); ?>
                <a title="Save Order" href="javascript:saveorder(<?php echo $total_inpage - 1;?>, 'saveinorder')"><?php echo $this->Html->image('filesave.png');?></a>
             </th>
             <th class="title">Tags</th>
            <th><?php echo $this->Paginator->sort('id', 'ID'); ?></th>
          </tr>
        </thead>
        <tfoot>
          <tr>
            <td colspan="16"><?php echo $this->element('paging', array('paging'=>$this->Paginator));?></td>
          </tr>
        </tfoot>
        <tbody>
          <?php
				$tr_class = 0;
                                $i = ($start_page - 1) * $limit_page;
                                $j =    0;
				if($total)
				{
					foreach ($data as $row)
					{
                                            $tr_class = 1 - $tr_class;
				?>
          <tr class="row<?php echo $tr_class;?>">
            <td align="center"><?php echo $i + 1;?></td>
            <td align="center">
                <input id="cb<?php echo $j; ?>" onclick="isChecked(this.checked);" type="checkbox" name="cid[]" value="<?php echo $row['Game']['id']; ?>" />
            </td>
            <td><?php echo $this->Html->link($row['Game']['title'], array('action'=>'edit','id'=> $row['Game']['id'])); ?></td>
         
<td><?php echo $row['Catgame']['title']; ?></td>
<td><?php echo $row['game_groups']['title']; ?></td>
<td align="center"><?php $this->Published->published("cb$i", $row['Game']['published']);?></td>
<td align="center"><?php $this->Popular->popular("cb$i", $row['Game']['popular']);?></td>

<td align="center"><?php $this->Hotgame->hotgame("cb$j", $row['Game']['hot_game']);?></td>
        <td align="center">
            <input type="text" value="<?php echo $row['Game']['hot_game_ordering']; ?>" name="hotgame_order[<?php echo $row['Game']['id']; ?>]" id="hotgame_ordering_<?php echo $row['Game']['id']; ?>" style="text-align: center;" size="5" class="text_area">
        </td>

        <td align="center"><?php $this->Populargameincat->populargameincat("cb$j", $row['Game']['popular_incat']);?></td>
         <td align="center">
            <input type="text" value="<?php echo $row['Game']['popular_incat_ordering']; ?>" name="populargameincat_order[<?php echo $row['Game']['id']; ?>]" id="populargameincat_ordering_<?php echo $row['Game']['id']; ?>" style="text-align: center;" size="5" class="text_area">
        </td>

        <td align="center"><?php $this->Hotgameincat->hotgameincat("cb$j", $row['Game']['hot_game_incat']);?></td>
         <td align="center">
            <input type="text" value="<?php echo $row['Game']['hot_game_incat_ordering']; ?>" name="hotgameincat_order[<?php echo $row['Game']['id']; ?>]" id="hotgameincat_ordering_<?php echo $row['Game']['id']; ?>" style="text-align: center;" size="5" class="text_area">
        </td>

        <td align="center"><?php $this->Hotgamedaily->hotgamedaily("cb$j", $row['Game']['hot_game_daily']);?></td>
        <td align="center">
            <input type="text" value="<?php echo $row['Game']['hot_game_daily_ordering']; ?>" name="hotgamedaily_order[<?php echo $row['Game']['id']; ?>]" id="hotgamedaily_ordering_<?php echo $row['Game']['id']; ?>" style="text-align: center;" size="5" class="text_area">
        </td>
        <td align="center">
            <input type="text" value="<?php echo $row['Game']['ordering']; ?>" name="order[<?php echo $row['Game']['id']; ?>]" id="ordering_<?php echo $row['Game']['id']; ?>" style="text-align: center;" size="5" class="text_area">
        </td>
        <td align="center">
            <input type="text" value="<?php echo $row['Game']['incat_ordering']; ?>" name="incat_order[<?php echo $row['Game']['id']; ?>]" id="incat_ordering_<?php echo $row['Game']['id']; ?>" style="text-align: center;" size="5" class="text_area">
        </td>
        <td align="center"><a href="javascript:void(0);" onclick="selectTags('<?php echo $row['Game']['id']; ?>');">Tags</a></td>
         <td align="center"><?php echo $row['Game']['id'];?></td>
          </tr>
          <?php
                                    $i++;
                                    $j++;
					}
				}
				else
				{
				?>
          <tr>
            <td align="center" colspan="16"> No contents </td>
          </tr>
          <?php
				}
				?>
        </tbody>
      </table>
      <input type="hidden" name="task" value="index" />
      <input type="hidden" name="boxchecked" value="0" />
      <?php echo $this->FORM_TOKEN;?>
    </form>
    <div class="clr"></div>
  </div>
  <div class="b">
    <div class="b">
      <div class="b"></div>
    </div>
  </div>
</div>
<div class="tags">

</div>